<?php
/**
 * Created by openXtiger.org.
 * User: xtiger
 * Date: 2009-6-17
 * Time: 20:26:23
 */
function icweb_category_execute() {
    $mc = xt_load('model','icweb.categorymodel');
    for($i=0;$i<6;$i++) {
        $p = $mc('retrievePath',1032277,' / ');
        echo $p,'<br/>';
    }

    return NONE;//'icweb/category';
}
function icweb_category_show() {
    $mc = xt_load('model','icweb.categorymodel');
    $tree = $mc('getTree');
    $right = array();
    echo '<pre>';
    foreach($tree as $v) {
        if (count($right) > 0) {
            while ($right[count($right) - 1] < $v['rgt']) {
                array_pop($right);
            }
        }
        echo str_repeat(' ',count($right)*5-strlen($v['lft'])+5) .'<span style="color:#CCCCCC">'.$v['lft'] .'</span>  '.$v['name'].'('. $v['id'].','. $v['pid'].')  <span style="color:#CCCCCC">'.$v['rgt'].'</span>'. "\n";
        $right[] = $v['rgt'];
    }
    echo '</pre>';
    return NONE;
}
?>